//
//  TMGEleSignViewController.m
//  TMGold
//
//  Created by Mac on 2017/12/8.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGEleSignViewController.h"
#import "TMGApplySignViewController.h"
@interface TMGEleSignViewController ()

@end

@implementation TMGEleSignViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"电子签名证书";
    [self configSubView];
    // Do any additional setup after loading the view.
}
#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 100)];
    header.backgroundColor = [UIColor whiteColor];
    
    STButton * buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth - 0, 44)
                                                     title:@"申请电子签名证书"
                                                titleColor:TM_orangeColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:self.tableView.backgroundColor
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"申请"]];
    [header addSubview:buyButton];
    buyButton.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    buyButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
    
    NSString * desStr = @"·黄金口袋将通过法大大为您申请一个与个人身份绑定的电子签名证书，该证书由中国金融证书中心(CFCA)颁发。证书申请成功后，您与黄金口袋签订的每一分投资协议都会带有您和黄金口袋双方的电子签名，有效保证了电子合同的法律效力。\n\n·CFCA是中国人民银行和国家信息安全管理机构批准成立的国家级,权威的安全机构，国内90%以上的银行均使用期提供的电子认证服务。\n\n";
    STLabel * desLable = [[STLabel alloc] initWithFrame:CGRectMake(15, buyButton.bottom , UIScreenWidth - 30, 200)
                                                   text:desStr
                                              textColor:TM_secendTextColor
                                                   font:14
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentLeft];
    [NSString lableAutoAdjustheightWithLabel:desLable];
    desLable.height = desLable.height;
    //    desLable.attributedText = [desLable.text st_convertAttributeStringWithKeyWords:@[@"·",@"·",@"·"] attributes:@[@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor}]];
    [header addSubview:desLable];
    
    UIView * garwView = [[UIView alloc] initWithFrame:CGRectMake(0, desLable.bottom, UIScreenWidth, 10)];
    garwView.backgroundColor = self.tableView.backgroundColor;
    [header addSubview:garwView];
    
    __weak typeof(self) weakSelf =  self;
    STButton * applyButton = [[STButton alloc] initWithFrame:CGRectMake(15, garwView.bottom , UIScreenWidth - 30, 44)
                                                     title:@"您还未申请电子签章  立即申请"
                                                titleColor:TM_secendTextColor
                                                 titleFont:15
                                              cornerRadius:0
                                           backgroundColor:[UIColor whiteColor]
                                           backgroundImage:nil
                                                     image:nil];
    [applyButton setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedAppkyButton];
    }];
    [applyButton setAttributedTitle:[applyButton.currentTitle st_convertAttributeStringWithKeyWord:@"立即申请"
                                                                                        attributes:@{NSForegroundColorAttributeName:TM_orangeColor}] forState:UIControlStateNormal];
    [header addSubview:applyButton];
    
    header.height = applyButton.bottom ;
    self.tableView.tableHeaderView = header;
}
#pragma mark --Action Method
- (void)onSelectedAppkyButton{
    [self.navigationController pushViewController:[TMGApplySignViewController new] animated:YES];
}

@end
